package com.bw.apply.view

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.bw.apply.R
import com.bw.apply.adpter.ApplyAdapter
import com.bw.apply.databinding.ActivityApplyBinding
import com.bw.apply.entity.ApplyEntity
import com.bw.apply.net.ApplyViewModel
import com.bw.base.constants.RoutePath
import com.bw.common.view.BaseMvvmActivity

@Route(path = RoutePath.PATH_APPLY)
class ApplyActivity : BaseMvvmActivity<ActivityApplyBinding,ApplyViewModel>() {
    lateinit var applyAdapter: ApplyAdapter
    val list = arrayListOf<ApplyEntity>()
    override fun initView() {
        list.add(ApplyEntity("车位申请","待审批","申请地下停车场B2-108车位","2023-12-28 14:30"))
        list.add(ApplyEntity("来访申请","已通过","访客：陈明远（3人）|来访时间：2023-12-27","2023-12-26 09:15"))
        list.add(ApplyEntity("报修申请","已拒绝","办公室空调维修（A栋1203)","2023-12-25 16:45"))
        list.add(ApplyEntity("巡更申请","已通过","B区域夜间巡更路线调整申请","2023-12-24 11:20"))
        applyAdapter = ApplyAdapter()
        binding.re.adapter = applyAdapter
        binding.re.layoutManager = LinearLayoutManager(this)
        applyAdapter.data.addAll(list)
        applyAdapter.notifyDataSetChanged()
        applyAdapter.setOnItemClickListener { adapter, view, position ->
            ARouter.getInstance().build(RoutePath.PATH_APPLY_DETAIL).navigation()
        }
    }

    override fun initData() {
        binding.chewei.setOnClickListener {
            ARouter.getInstance().build(RoutePath.PATH_PACK_CAR).navigation()
        }
        binding.visit.setOnClickListener {
            ARouter.getInstance().build(RoutePath.PATH_VISITOR).navigation()
        }
        binding.repair.setOnClickListener {
            ARouter.getInstance().build(RoutePath.PATH_REPAIR).navigation()
        }
        binding.find.setOnClickListener {
            ARouter.getInstance().build(RoutePath.PATH_POLLING).navigation()
        }
    }

}